package com.piper.provider.controller;

import com.piper.provider.service.RedisCacheService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/redis/")
public class RedisCacheController {

    @Resource
    private RedisCacheService redisCacheService;

    @GetMapping("put")
    public String put(@RequestParam(name = "key") String key) {
        return redisCacheService.put(key);
    }

    @GetMapping("get")
    public String get(@RequestParam(name = "key") String key) {
        return redisCacheService.get(key);
    }

    @GetMapping("del")
    public void del(@RequestParam(name = "key") String key) {
        redisCacheService.del(key);
    }

}
